package top.purity.server.gateway.feign.input;

import top.purity.framework.common.GlobalConstant;
import top.purity.server.gateway.feign.input.dto.PermissionDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

/**
 * path 表示 对应服务的 context-path
 * contextId feign接口的唯一id 表示 如果存在多个 同服务的 feign 接口，那么 contextId相当于别名
 */
@FeignClient(value = "user", contextId = "user", path = "/user")
public interface UserFeign {

    String PREFIX = GlobalConstant.RPC_PREFIX + "/user";

    @PostMapping(PREFIX + "/isRootAdmin/{userId}/{tenantId}")
    Boolean isRootAdmin(@PathVariable("userId") Long userId, @PathVariable("tenantId") Long tenantId);

    @PostMapping( PREFIX + "/getPermission/{userId}/{tenantId}")
    List<PermissionDTO> getPermission(@PathVariable("userId") Long userId, @PathVariable("tenantId") Long tenantId);

}
